package com.it.cdw.controller;

import cn.hutool.core.util.CharsetUtil;
import cn.hutool.crypto.SecureUtil;
import cn.hutool.crypto.symmetric.SymmetricCrypto;
import com.it.cdw.feign.ConsumerFeign;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Arrays;

@RestController
public class ConsumerController {
    @Autowired
    private ConsumerFeign consumerFeign;

    @GetMapping("/index")
    public String index(){
        return "hello cdw";
    }
    @GetMapping("/getInfo")
    public String getProvider(){
        return "消费者调用生产者:"+consumerFeign.index();
    }

    public static void main(String[] args) {
        String c = "2222";

        SymmetricCrypto sm4 = new SymmetricCrypto("SM4");
        String encryptHex = sm4.encryptHex(c);
        System.out.printf("加密后:"+ encryptHex);
        String decryptStr = sm4.decryptStr(encryptHex, CharsetUtil.CHARSET_UTF_8);
        System.out.printf("解密后："+decryptStr);
    }
}
